import { OmitType } from '@nestjs/mapped-types';
import { IsFile, MemoryStoredFile } from 'nestjs-form-data';
import { createZodDto } from 'nestjs-zod';
import { z } from 'zod';

export const GetItemsByIdsRequestSchema = z.object({
  ids: z.array(z.number()).default([]),
});

export type GetItemsByIdsRequest = z.infer<typeof GetItemsByIdsRequestSchema>;
export class GetItemsByIdsDto extends createZodDto(
  GetItemsByIdsRequestSchema,
) {}

export class ItemDto {
  @IsFile()
  file: MemoryStoredFile;

  description: string;
  name: string;
  price: string;
  categoryId: string;
}

export class WithoutFileDto extends OmitType(ItemDto, ['file']) {}
